home *** CD-ROM | disk | FTP | other *** search
- #include "Quickdraw.h"
- #include "Events.h"
- #include "Fonts.h"
- #include "Memory.h"
- #include "Windows.h"
- #include "Menus.h"
- #include "TextEdit.h"
- #include "Dialogs.h"
-
- #include <stdio.h>
- #include <string.h>
-
- #include "math.h"
-
- #include "Displays.h"
-
- #include "DrawSprocket.h"
-
- // Globals---------------------------------------------------------------------------
- DisplayObject gDisplayObject;
- long gFinalTickCount;
- Boolean gAutopilot = false;
-
- // Local prototypes------------------------------------------------------------------
-
- void
- InitToolbox(void);
-
- void
- EventLoop( void );
-
- WindowPtr CreateWindow( void );
-
- void
- DestroyWindow( WindowPtr win );
-
- void TestDrawSprocket( void );
- void TestDrawSprocketModes( void );
- void TestDrawSprocketGDevices( void );
- void TestDrawSprocketDisplays( void );
- void DestroyDisplayObjects( void );
- void TestDrawSprocketGamma( void );
- void TestDrawSprocketBuffering( void );
- void DumpDisplayConfig( DisplayConfig *inConfig );
- void IncrementColor( RGBColor *ioColor );
-
- void
- TestDrawSprocket( void )
- {
- char text[10];
-
- printf("type anything to run in autopilot mode, or press <RETURN> to\n");
- printf("run in manual mode: ");
- gets(text);
- if( text[0] )
- gAutopilot = true;
-
- TestDrawSprocketGDevices();
- TestDrawSprocketModes();
- TestDrawSprocketDisplays();
- TestDrawSprocketGamma();
- TestDrawSprocketBuffering();
-
- // cleanup
- DestroyDisplayObjects();
-
- printf("\n\n### testing is complete ###\n");
- }
-
- void main()
- {
- InitToolbox();
-
- TestDrawSprocket();
-
- // EventLoop();
- }
-
- void
- EventLoop( void )
- {
- Boolean done = false;
- WindowPtr win;
- EventRecord theEvent;
- WindowPtr whichWin;
- Point pt;
- short winPart;
- Boolean gotEvent = false;
- QDGlobals* theQDGlobalsPtr;
-
- win = CreateWindow();
- if( NULL == win )
- return;
-
- SetPort(win);
-
- while ( !done )
- {
- gotEvent = WaitNextEvent( everyEvent, &theEvent, 5, NULL );
- if ( gotEvent || theEvent.what == nullEvent )
- {
- switch (theEvent.what)
- {
- case keyDown:
- done = true;
- break;
-
- case updateEvt:
- whichWin = (WindowPtr)theEvent.message;
- if ( whichWin == win )
- {
- SetPort(win);
- BeginUpdate(win);
- //DrawWindow( win );
- EndUpdate(win);
- }
- break;
- case mouseDown:
- winPart = FindWindow(theEvent.where, &whichWin);
-
- if ( whichWin != win )
- break;
-
- if ( whichWin != FrontWindow() )
- {
- SelectWindow( whichWin );
- }
- else switch ( winPart )
- {
- case inGoAway:
- if (TrackGoAway(whichWin, theEvent.where))
- {
- done = true;
- }
- break;
- case inDrag:
- DragWindow( whichWin, theEvent.where, &(qd.screenBits.bounds));
- break;
- case inContent:
- pt = theEvent.where;
- SetPort(whichWin);
- GlobalToLocal(&pt);
- break;
- }
- break;
- case app4Evt:
- if (theEvent.message & 0x01000000)
- { /* suspend/resume */
- if (theEvent.message & 0x00000001)
- {
- /* add whatever else to resume your application */
- } else
- {
- /* add whatever else to suspend your application */
- }
- }
- break;
- }
- }
- }
-
- DestroyWindow( win );
- }
-
- void
- InitToolbox(void)
- {
- MaxApplZone();
- InitGraf(&qd.thePort);
- InitFonts();
- FlushEvents( everyEvent, 0 );
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- }
-
- WindowPtr
- CreateWindow( void )
- {
- GDHandle theMainGDevice;
- Rect theBoundsRect;
- WindowPtr theNewWindow;
-
- theMainGDevice = GetMainDevice();
- if( NULL == theMainGDevice )
- return NULL;
-
- theBoundsRect = (**theMainGDevice).gdRect;
- theNewWindow = NewCWindow(\
- NULL, // wStorage
- &theBoundsRect, // boundsRect
- NULL, // title
- TRUE, // visible
- plainDBox, // procID
- (WindowPtr)-1, // behind
- FALSE, // goAwayFlag
- 0); // refCon
-
- return theNewWindow;
- }
-
- void
- DestroyWindow( WindowPtr win )
- {
- DisposeWindow( win );
- }
-
- void
- TestDrawSprocketGDevices( void )
- {
- GDHandle theMainGDevice, theRestoredGDevice, theTempGDevice;
- OSErr theError;
-
- printf("\n### Testing GDevices ###\n");
-
- theMainGDevice = GetMainDevice();
- if( NULL == theMainGDevice )
- return;
-
- // duplicate the main gdevice and compare it
- theTempGDevice = theMainGDevice;
- theError = HandToHand( (Handle *)&theTempGDevice );
- if( theError )
- {
- printf("error %d from HandToHand duplicating main GDevice.\n", theError );
- return;
- }
- theError = RestoreSavedGDevice( theTempGDevice, &theRestoredGDevice );
- if( theRestoredGDevice != theMainGDevice )
- printf("RestoreSavedGDevice did not match the main GDevice!\n");
- else
- printf("restored the main GDevice successfully\n");
- DisposeHandle( (Handle)theTempGDevice );
-
- }
-
- void
- TestDrawSprocketModes( void )
- {
- UInt32 theModeCount;
- UInt32 theModeIndex;
- OSErr theError;
- DisplayConfig theConfig, theActualConfig;
- GDHandle theGDevice;
- SInt32 theTimingMode, theDepthMode;
-
- theGDevice = GetMainDevice();
- printf("the main GDevice is at 0x%X\n", theGDevice);
-
- printf("\n### Testing Modes ###\n");
-
- theGDevice = DMGetFirstScreenDevice( true );
- while( theGDevice )
- {
- // get the # of timing modes
- theError = GetModeCount( theGDevice, &theModeCount );
- if( theError )
- {
- printf( "error %d from GetModeCount\n", theError );
- return;
- }
- printf( "there are %d modes for the GDevice at 0x%X.\n", theModeCount,
- theGDevice );
-
- // iterate through the modes
- for( theModeIndex = 0; theModeIndex < theModeCount;
- theModeIndex++ )
- {
- theConfig.device = theGDevice;
- theConfig.mode = theModeIndex;
-
- theError = GetModeCapabilities( &theConfig );
- if( theError )
- {
- printf("Error %d from GetModeCapabilities\n", theError );
- return;
- }
- printf("mode %d capabilities:\n", theModeIndex );
- DumpDisplayConfig( &theConfig );
- }
-
- // next GDevice
- theGDevice = DMGetNextScreenDevice( theGDevice, true );
- }
- // find the best configurations
-
- // 320x200x8
- theConfig.width = 320;
- theConfig.height = 200;
- theConfig.specialFlags = 0;
- theConfig.specialFlagsInHW = 0;
- theConfig.frontBufferDepthMask = kDisplayDepthMask8;
- theConfig.backBufferDepthMask = kDisplayDepthMask8;
- theConfig.frontBufferBestDepth = 8;
- theConfig.backBufferBestDepth = 8;
- theConfig.reserved1 = 0;
- theConfig.reserved2 = 0;
- theError = FindGDeviceFromConfig( &theConfig );
- if( theError )
- printf("error %d from FindGDeviceFromConfig\n", theError );
- else
- {
- printf("best match for 320x200x8 is mode %d of GDevice at 0x%X\n", theConfig.mode,
- theConfig.device );
-
- printf("the actual config for the mode is:\n");
- theActualConfig.device = theConfig.device;
- theActualConfig.mode = theConfig.mode;
- GetModeCapabilities( &theActualConfig );
- DumpDisplayConfig( &theActualConfig );
- }
-
- // 320x240x16
- theConfig.width = 320;
- theConfig.height = 240;
- theConfig.specialFlags = 0;
- theConfig.specialFlagsInHW = 0;
- theConfig.frontBufferDepthMask = kDisplayDepthMask16;
- theConfig.backBufferDepthMask = kDisplayDepthMask16;
- theConfig.frontBufferBestDepth = 16;
- theConfig.backBufferBestDepth = 16;
- theConfig.reserved1 = 0;
- theConfig.reserved2 = 0;
- theError = FindGDeviceFromConfig( &theConfig );
- if( theError )
- printf("error %d from FindGDeviceFromConfig\n", theError );
- else
- {
- printf("best match for 320x240x16 is mode %d of GDevice at 0x%X\n", theConfig.mode,
- theConfig.device );
-
- printf("the actual config for the mode is:\n");
- theActualConfig.device = theConfig.device;
- theActualConfig.mode = theConfig.mode;
- GetModeCapabilities( &theActualConfig );
- DumpDisplayConfig( &theActualConfig );
- }
-
- // 640x480x8
- theConfig.width = 640;
- theConfig.height = 480;
- theConfig.specialFlags = 0;
- theConfig.specialFlagsInHW = 0;
- theConfig.frontBufferDepthMask = kDisplayDepthMask8;
- theConfig.backBufferDepthMask = kDisplayDepthMask8;
- theConfig.frontBufferBestDepth = 8;
- theConfig.backBufferBestDepth = 8;
- theConfig.reserved1 = 0;
- theConfig.reserved2 = 0;
- theError = FindGDeviceFromConfig( &theConfig );
- if( theError )
- printf("error %d from FindGDeviceFromConfig\n", theError );
- else
- {
- printf("best match for 640x480x8 is mode %d of GDevice at 0x%X\n", theConfig.mode,
- theConfig.device );
-
- printf("the actual config for the mode is:\n");
- theActualConfig.device = theConfig.device;
- theActualConfig.mode = theConfig.mode;
- GetModeCapabilities( &theActualConfig );
- DumpDisplayConfig( &theActualConfig );
- }
-
- // 640x480x32 (depth not required)
- theConfig.width = 640;
- theConfig.height = 480;
- theConfig.specialFlags = 0;
- theConfig.specialFlagsInHW = 0;
- theConfig.frontBufferDepthMask = kDisplayDepthMaskAll;
- theConfig.backBufferDepthMask = kDisplayDepthMaskAll;
- theConfig.frontBufferBestDepth = 32;
- theConfig.backBufferBestDepth = 32;
- theConfig.reserved1 = 0;
- theConfig.reserved2 = 0;
- theError = FindGDeviceFromConfig( &theConfig );
- if( theError )
- printf("error %d from FindGDeviceFromConfig\n", theError );
- else
- {
- printf("best match for 640x480x32 (depth not required) is mode %d of GDevice at 0x%X\n",
- theConfig.mode, theConfig.device );
-
- printf("the actual config for the mode is:\n");
- theActualConfig.device = theConfig.device;
- theActualConfig.mode = theConfig.mode;
- GetModeCapabilities( &theActualConfig );
- DumpDisplayConfig( &theActualConfig );
- }
-
- }
-
- void TestDrawSprocketDisplays( void )
- {
- DisplayConfig theConfig, theReturnedConfig;
- UInt32 thePlayState;
- OSErr theError;
- char text[80];
- int theIndex;
-
- printf("\n### Testing Displays ###\n");
-
- // DSp_SetDebugMode( true );
-
- // 640x480x8
- theConfig.width = 640;
- theConfig.height = 480;
- theConfig.specialFlags = kDisplaySpecialBuffered;
- theConfig.specialFlagsInHW = 0;
- theConfig.frontBufferDepthMask = kDisplayDepthMaskAll;
- theConfig.backBufferDepthMask = kDisplayDepthMaskAll;
- theConfig.frontBufferBestDepth = 8;
- theConfig.backBufferBestDepth = 8;
- theConfig.pageCount = 2;
- theConfig.reserved1 = 0;
- theConfig.reserved2 = 0;
- theConfig.colorTable = NULL;
- theError = FindGDeviceFromConfig( &theConfig );
- if( theError )
- {
- printf("error %d from FindGDeviceFromConfig, aborting program\n", theError );
- gets(text);
- ExitToShell();
- }
-
- // get the display
- theError = NewDisplay( &theConfig, &gDisplayObject );
- if( theError )
- printf("error %d from NewDisplay\n", theError );
-
- // get the play state
- theError = GetDisplayPlayState( gDisplayObject, &thePlayState );
- if( theError )
- {
- printf("error %d from GetDisplayPlayState()\n", theError );
- return;
- }
- if( kDisplayPlayStateInactive != thePlayState )
- {
- printf("display state should be inactive, but its not. state = %d\n", thePlayState );
- }
- else
- printf("play state is inactive (correct).\n");
-
- // enter play mode
- if( !gAutopilot )
- {
- printf("press <RETURN> to change dispay modes, then <RETURN> again to come back\n");
- gets(text);
- }
- theError = SetDisplayPlayState( gDisplayObject, kDisplayPlayStateActive );
- if( theError )
- {
- printf("error %d from SetDisplayPlayState(kDisplayPlayStateActive)\n", theError );
- return;
- }
-
- // get the play state
- theError = GetDisplayPlayState( gDisplayObject, &thePlayState );
- if( theError )
- {
- printf("error %d from GetDisplayPlayState()\n", theError );
- return;
- }
- if( kDisplayPlayStateActive != thePlayState )
- {
- printf("display state should be active, but its not. state = %d\n", thePlayState );
- }
- else
- printf("play state is active (correct).\n");
-
- // wait for a bit
- if( !gAutopilot )
- {
- gets(text);
- }
-
- // exit play mode
- theError = SetDisplayPlayState( gDisplayObject, kDisplayPlayStateInactive );
- if( theError )
- {
- printf("error %d from SetDisplayPlayState(kDisplayPlayStateInactive)\n", theError );
- return;
- }
-
- // get the play state
- theError = GetDisplayPlayState( gDisplayObject, &thePlayState );
- if( theError )
- {
- printf("error %d from GetDisplayPlayState()\n", theError );
- return;
- }
- if( kDisplayPlayStateInactive != thePlayState )
- {
- printf("display state should be inactive, but its not. state = %d\n", thePlayState );
- }
- else
- printf("play state is inactive (correct).\n");
-
- // watch the frame count for a little bit
- for( theIndex = 0; theIndex < 10; theIndex++ )
- {
- UInt32 theFrame;
-
- theFrame = GetDisplayFrameCount( gDisplayObject );
- printf("current display frame is %d\n", theFrame);
- Delay(10, &gFinalTickCount);
- }
-
- // get the requested config
- theError = GetDisplayConfig( gDisplayObject, &theReturnedConfig );
- if( theError )
- {
- printf("error %d from GetDisplayConfig()\n", theError );
- return;
- }
-
- // dump our config
- printf("True Requested Config:\n");
- DumpDisplayConfig( &theConfig );
-
- // dump requested config from display object
- printf("Returned Requested Config:\n");
- DumpDisplayConfig( &theReturnedConfig );
-
- // get the actual config
- theError = GetDisplayActualConfig( gDisplayObject, &theReturnedConfig );
- if( theError )
- {
- printf("error %d from GetDisplayConfig()\n", theError );
- return;
- }
-
- // dump actual config
- printf("Returned Actual Config:\n");
- DumpDisplayConfig( &theReturnedConfig );
-
- }
-
- void DumpDisplayConfig(
- DisplayConfig *inConfig
- )
- {
- printf("\tdevice = 0x%0X\n", inConfig->device );
- printf("\tmode = 0x%0X\n", inConfig->mode );
- printf("\tfrequency = 0x%0X\n", inConfig->frequency );
- printf("\twidth = %d\n", inConfig->width );
- printf("\theight = %d\n", inConfig->height );
- printf("\tcolorNeeds = 0x%0X\n", inConfig->colorNeeds );
- printf("\tcolorTable = 0x%0X\n", inConfig->colorTable );
- printf("\tspecialFlags = 0x%0X\n", inConfig->specialFlags );
- printf("\tspecialFlagsInHW = 0x%0X\n", inConfig->specialFlagsInHW );
- printf("\tbackBufferDepthMask = 0x%0X\n", inConfig->backBufferDepthMask );
- printf("\tfrontBufferDepthMask = 0x%0X\n", inConfig->frontBufferDepthMask );
- printf("\tbackBufferBestDepth = %d\n", inConfig->backBufferBestDepth );
- printf("\tfrontBufferBestDepth = %d\n", inConfig->frontBufferBestDepth );
- printf("\tpageCount = 0x%0X\n", inConfig->pageCount );
- printf("\treserved1 = 0x%0X\n", inConfig->reserved1 );
- printf("\treserved2 = 0x%0X\n", inConfig->reserved2 );
- }
-
- void DestroyDisplayObjects( void )
- {
- OSErr theError;
-
- if( gDisplayObject )
- {
- theError = DisposeDisplay( gDisplayObject );
- if( theError )
- printf("error %d from DisposeDisplay\n", theError );
- gDisplayObject = NULL;
- }
- }
-
- void
- TestDrawSprocketGamma( void )
- {
- OSErr theError;
- char text[10];
- RGBColor theColor;
-
- printf("\n\n### testing gamma ###\n");
-
- if( !gAutopilot )
- {
- printf("press <RETURN>\n");
- gets(text);
- }
-
- // fade to black, all display objects
- theError = FadeDisplayGamma( NULL, kSmoothFadeOut, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- // activate the display object
- SetDisplayPlayState( gDisplayObject, kDisplayPlayStateActive );
- Delay(30, &gFinalTickCount);
-
- // bring the display back in
- theError = FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- if( !gAutopilot )
- {
- printf("press <RETURN>\n");
- gets(text);
- }
-
- // fade to color, only one display object
- theColor.red = 0xffff;
- theColor.green = 0;
- theColor.blue = 0;
-
- theError = FadeDisplayGamma( gDisplayObject, kSmoothFadeOut, &theColor );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- if( !gAutopilot )
- {
- printf("press <RETURN>\n");
- gets(text);
- }
-
- // fade back in
- theError = FadeDisplayGamma( gDisplayObject, kSmoothFadeIn, &theColor );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- if( !gAutopilot )
- {
- printf("press <RETURN>\n");
- gets(text);
- }
-
- // fade to black, all display objects
- theError = FadeDisplayGamma( NULL, kSmoothFadeOut, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- // inactivate the display object
- SetDisplayPlayState( gDisplayObject, kDisplayPlayStateInactive );
- Delay(30, &gFinalTickCount);
-
- // bring the display back in
- theError = FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
- }
-
- void TestDrawSprocketBuffering( void )
- {
- GWorldPtr theGWorld;
- OSStatus theError;
- char text[10];
- PixMapHandle thePixMap;
- UInt32 theCount;
- Rect theRect, theRectangleRect;
- Str255 theText;
- DisplayConfig theConfig;
- UInt32 theMaxTick, theStartTick, theCurrentTick, theWidth;
- SInt32 theXPos, theYPos;
- RGBColor theColor, theTextColor;
- SInt32 theRectangleDelta;
- GDHandle theOldGDevice;
- GWorldPtr theOldGWorld;
-
- printf("\n\n### testing buffering ###\n");
- if( !gAutopilot )
- {
- printf("During these tests the console window will not be visible!\n");
- printf("Just watch the display, you should see a swap every 1/2 second.\n\n");
- printf("press <RETURN> to begin\n");
- gets(text);
- }
-
- // DSp_SetDebugMode( true );
-
- // get the display attributes (the ones I think they are, not necessarily
- // the real ones)
- GetDisplayConfig( gDisplayObject, &theConfig );
-
- // fade to black, all display objects
- theError = FadeDisplayGamma( NULL, kSmoothFadeOut, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- // activate the display object
- SetDisplayPlayState( gDisplayObject, kDisplayPlayStateActive );
- Delay(30, &gFinalTickCount);
-
- // bring the display back in
- theError = FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- GetGWorld( &theOldGWorld, &theOldGDevice );
-
- // do the double buffering
- theColor.red = 0;
- theColor.green = 0;
- theColor.blue = 0;
- theTextColor.red = 0xFFFF;
- theTextColor.green = 0xFFFF;
- theTextColor.blue = 0xFFFF;
-
- // rectangle will be 1/8 the display width, and all of the height
- SetRect( &theRectangleRect, 0, 0, theConfig.width >> 3, theConfig.height );
-
- theStartTick = theCurrentTick = TickCount();
- theMaxTick = theStartTick + (15 * 60);
- theCount = 0;
- theRectangleDelta = 3;
- while( theCurrentTick < theMaxTick )
- {
- // get the back buffer
- theError = GetDisplayBackBuffer( gDisplayObject, &theGWorld );
- if( theError )
- {
- printf("error %d from GetDisplayBackBuffer\n", theError );
- return;
- }
-
- // set the current gworld
- SetGWorld( theGWorld, NULL );
-
- // clear the buffer
- EraseRect( &theGWorld->portRect );
-
- // fill the display with sliding vertical rectangle
- IncrementColor( &theColor );
- RGBForeColor( &theColor );
- PaintRect( &theRectangleRect );
-
- if( ( (theRectangleRect.right + theRectangleDelta) > theConfig.width ) ||
- ( (theRectangleRect.left + theRectangleDelta) < 0 ) )
- {
- theRectangleDelta = -theRectangleDelta;
- }
- theRectangleRect.left += theRectangleDelta;
- theRectangleRect.right += theRectangleDelta;
-
- // draw a frame counter
- sprintf((char *)&theText[1], "This is frame %d (%d ticks remaining, %.2f fps)",
- theCount + 1, theMaxTick - theCurrentTick,
- (float)(theCount / ((theCurrentTick - theStartTick) / 60.0)) );
- theText[0] = strlen( (char *)&theText[1] );
- theWidth = StringWidth( (ConstStr255Param)theText );
- theXPos = ( theConfig.width >> 1 ) - ( theWidth >> 1 );
- theYPos = theConfig.height - 20;
-
- theTextColor.red = 0;
- theTextColor.green = 0;
- theTextColor.blue = 0;
- RGBForeColor( &theTextColor );
- SetRect( &theRect, theXPos - 10, theYPos - 20, theXPos + theWidth + 10, theYPos + 10 );
- PaintRect( &theRect );
-
- theTextColor.red = 0;
- theTextColor.green = 0xFFFF;
- theTextColor.blue = 0xFFFF;
- RGBForeColor( &theTextColor );
- FrameRect( &theRect );
-
- MoveTo( theXPos, theYPos );
- DrawString( (ConstStr255Param)theText );
-
- // swap the buffers
- theError = SwapDisplayBuffers( gDisplayObject, NULL, 0 );
- if( theError )
- {
- printf("error %d from SwapDisplayBuffers\n", theError );
- return;
- }
-
- // increase frame counter
- theCount++;
- theCurrentTick = TickCount();
- }
-
- SetGWorld( theOldGWorld, theOldGDevice );
-
- // fade to black, all display objects
- theError = FadeDisplayGamma( NULL, kSmoothFadeOut, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
-
- // inactivate the display object
- SetDisplayPlayState( gDisplayObject, kDisplayPlayStateInactive );
- Delay(30, &gFinalTickCount);
-
- // bring the display back in
- theError = FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- if( theError )
- {
- FadeDisplayGamma( NULL, kSmoothFadeIn, NULL );
- printf("error %d from FadeDisplayGamma\n", theError );
- return;
- }
- }
-
- void
- IncrementColor( RGBColor *ioColor )
- {
- // increment red
- ioColor->red += 0x0100;
- if( ioColor->red >= 0xFE00 )
- {
- ioColor->red = 0;
-
- // increment green
- ioColor->green += 0x0100;
- if( ioColor->green >= 0xFE00 )
- {
- ioColor->green = 0;
-
- // increment blue
- ioColor->blue += 0x0100;
- if( ioColor->blue >= 0xFE00 )
- {
- ioColor->blue = 0;
- }
- }
- }
- }